const { model } = require('../db')
const schema = require('../schemas/userSchema')
const BaseModel = require( './baseModel' );
const user = model( 'User', schema ) 

class userModel extends BaseModel { 
    constructor ( db ) { 
        super( db );
    }
/**
 * 验证密码和账号是否在集合中存在 
 * @param {账号} username string
 * @param {密码} password string
 * @return 
 */
    async checkLogin (username,password) { 
        let res = await this.first( { username, password } );
        console.log( res );
        console.log( res ? res : false );
      return res ? res : false;
      
    }
}


module.exports = new userModel( user );